﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;
using Models;

namespace ReaManagementSystem.Controllers
{
    public class AdministratorsController : Controller
    {
        // GET: Administrators
        public ActionResult AdministratorLogin()
        {
            return View();
        }
        [HttpPost]
        public ActionResult AdministratorLogin(string BName,string BPassword)
        {
            if (BackstageManager.AdministratorLogin(BName, BPassword))
            {
                Response.Redirect("AdministratorHome");
                TempData["adminname"] = BName;
            }
            else
            {
                Response.Write("<script>alert('登录失败！')</script>");
            }
            return View();
        }
        
        public ActionResult AdministratorHome()
        {
            return View();
        }
        /// <summary>
        /// 用户信息显示
        /// </summary>
        /// <returns></returns>
        public ActionResult UserShow()
        {
            var user= UserManager.GetUserselect();
            return View(user);
        }
        public ActionResult UserDelete(int id)
        {
            if (UserManager.GetUserdelete(id))
            {
                Response.Write("删除成功!");
            }
            return View();
        }

        public ActionResult UserBan()
        {
            var user = UserManager.GetUserselect();
            return View(user);
        }
        
        public ActionResult HouseShow()
        {
            var Houses = HouseManager.GetHousesselect();
            return View(Houses);
        }
        public ActionResult Toexamine()
        {
           
            var Houses = HouseManager.GetHousesselect();
            return View(Houses);
        }
    }
}